//
//  NSArray+EnumExtension.m
//  meets-ios
//
//  Created by Mark on 15/5/18.
//  Copyright (c) 2015年 meets. All rights reserved.
//

#import "NSArray+EnumExtension.h"

@implementation NSArray (EnumExtension)

- (NSString *)stringWithEnum:(NSUInteger)enumVal {
    return [self objectAtIndex:enumVal];
}

- (NSUInteger)enumFromString:(NSString *)strVal default:(NSUInteger)def {
    NSUInteger n = [self indexOfObject:strVal];
    if (n == NSNotFound) n = def;
    return n;
}

- (NSUInteger)enumFromString:(NSString *)strVal {
    return [self enumFromString:strVal default:0];
}

@end
